# ~~~
# Copyright (c) Sonosemi Medical Ltd.
# Author: Zhang Yisong(zhangyisong@sonosemi.com)
# ~~~

include(FetchContent)
FetchContent_Declare(
  cpm   
  GIT_REPOSITORY https://gitcode.com/gh_mirrors/cp/CPM.cmake.git
  GIT_TAG master  
  SOURCE_DIR   ${CMAKE_CURRENT_SOURCE_DIR}/../cpm
)

FetchContent_MakeAvailable(cpm)
include(${CMAKE_CURRENT_SOURCE_DIR}/../cpm/cmake/CPM.cmake)
cpmaddpackage("https://gitee.com/Ethan-ZYS/sml.git#master")
cpmaddpackage("https://gitee.com/Ethan-ZYS/mp11.git#ccfb558")
cpmaddpackage("https://gitcode.com/gh_mirrors/et/etl.git#master")
cpmaddpackage("https://gitee.com/Ethan-ZYS/cib.git#6f78578")
cpmaddpackage("https://gitee.com/Ethan-ZYS/pigweed.git#main")
add_library(active.lib INTERFACE)
add_library(active.msg INTERFACE)
target_include_directories(active.msg INTERFACE include/public)
target_include_directories(active.msg INTERFACE include)
target_link_libraries(active.msg INTERFACE cib.lib)
target_link_libraries(active.lib INTERFACE active.msg sml::sml etl::etl
                                           Boost::mp11)
add_library(activde.lib.thread INTERFACE)
target_link_libraries(activde.lib.thread INTERFACE pw_work_queue
                                                   pw_thread_zephyr.thread)
if(CONFIG_ACTIVE)
  target_link_libraries(app PRIVATE active.lib)
endif()
